import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Question12 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        
        String s = in.nextLine();
        StringBuilder sb = new StringBuilder(s);
        sb.deleteCharAt(0);
        sb.deleteCharAt(sb.length() - 1);

        String[] arrs = sb.toString().split(",");
        int[] nums = new int[arrs.length];

        for (int i = 0; i < arrs.length; i++) {
            nums[i] = Integer.valueOf(arrs[i]);

            nums[i] *= nums[i];
            // System.out.println(nums[i]);
        }

        // 排序
        for (int i = 0; i < nums.length; i++) {
            for (int j = 1; j < nums.length - i; j++) {
                if (nums[j] < nums[j - 1]) {
                    int temp = nums[j];
                    nums[j] = nums[j - 1];
                    nums[j - 1] = temp;
                }
            }
        }

        System.out.println(Arrays.toString(nums));

    }
}